import { request } from '@utils/http'
import {
  IParams,
  IhospitalListRes,
  IresList,
  Ihospital,
} from './model/hospitalListTypes'
// 获取医院列表数据的请求函数
export function reqGetHospitalList({
  page,
  pageSize,
  hoscode,
  hostype,
  hosname,
  status,
  provinceCode,
  cityCode,
  districtCode,
}: IParams) {
  return request.get<any, IhospitalListRes>(
    `/admin/hosp/hospital/${page}/${pageSize}`,
    {
      params: {
        hoscode,
        hostype,
        hosname,
        status,
        provinceCode,
        cityCode,
        districtCode,
      },
    }
  )
}

// 获取省数据的请求函数
export function reqGetProvince(dictCode: string = 'province') {
  return request.get<any, IresList>(
    `/admin/cmn/dict/findByDictCode/${dictCode}`
  )
}
// 获取市或区数据的请求函数
export function reqGetCityOrDistrict(parentId: string) {
  return request.get<any, IresList>(
    `/admin/cmn/dict/findByParentId/${parentId}`
  )
}
// 获取医院详情
export function reqGetHospitalShow(id: string) {
  return request.get<any, Ihospital>(`/admin/hosp/hospital/show/${id}`)
}
